<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>违法查询</title>
		<%include("/common/include.html"){}%>
		<link rel="stylesheet" href="${cxt!}/sb/plugins/ztree/css/zTreeStyle/zTreeStyle.css" type="text/css">
		<!-- <script src="${cxt !}/sb/js/fineRegistration/fineQuery.js" type="text/javascript" charset="utf-8"></script> -->
		<style type="text/css">
		.textbox {
			padding-right: 0px;
			background: url("${cxt !}/sb/themes/insdep/images/combo_arrow.png")
				no-repeat scroll right center transparent;
		}
		</style>
	</head>
	<body class="easyui-layout">
			<div data-options="region:'north',split: true,title:'快速查询'" style="height:200px;padding:10px;">
				<form id="fineInfoStatisticFrom" action="">
					
					
					<div style="margin-bottom: 10px;float:left;margin-right: 10px;">
						<label class="label-top" style="width: 100%; display: block;">开始日期</label>
						<input id = "startTime" name="_query.startTime" value='${date(),dateFormat="yyyy-MM-dd"}' class="easyui-datebox theme-textbox-radius" style="height:32px;width:212px;text-align:center" 
							data-options="editable: false,icons:[{
			                       iconCls:'icon-clear',
			                       handler: function(e){
			                           $(e.data.target).datetimespinner('clear');
			                       }
			                   }]"/>
					</div>
					<div style="margin-bottom: 10px;float:left;margin-right: 10px;">
						<label class="label-top" style="width: 100%; display: block;">结束日期</label>
						<input id = "endTime" name="_query.endTime" value='${date(),dateFormat="yyyy-MM-dd"}' class="easyui-datebox theme-textbox-radius" style="height:32px;width:212px;text-align:center" 
							data-options="editable: false,icons:[{
			                       iconCls:'icon-clear',
			                       handler: function(e){
			                           $(e.data.target).datetimespinner('clear');
			                       }
			                   }]"/>
					</div>
					<div style="margin-bottom: 10px;float:left;margin-right: 10px;">
						<label class="label-top" style="width: 100%; display: block;">罚款机构</label>
						<input id="organ" type="text" readonly style="width: 200px; height: 30px; padding-left: 10px;border-radius:3px" onclick="showMenu(); return false;" class="textbox" value="${curOrgan.name! }"/>
						<input name="_query.organIds" id="organIds" type="hidden" value="${curOrgan.ids! }">
						<input  id="initOrganName" type="hidden" value="${curOrgan.name! }">
						<input  id="initOrgan" type="hidden" value="${curOrgan.ids! }">
					</div>
					<div style="margin-bottom: 10px;float:left;margin-right: 10px;">
						<label class="label-top" style="width: 100%; display: block;">违法代码</label>
						<input class="easyui-combobox" style="height:32px;width:212px;text-align:center"  id="WFDM" name="_query.WFDM"
							data-options="
							url:'penalties/getPenalties',
							method:'post',
							valueField:'code',
							textField:'codecontent'
							">
					</div>
					<div style="margin-bottom: 10px;float:left;margin-right: 10px;">
						<label class="label-top" style="width: 100%; display: block;">车辆类型</label>
						<select name="_query.CLLX" class=" easyui-combobox theme-textbox-radius" id = "CLLX" style="width:212px;height:32px;text-align:center" data-options="editable: false">
							<option value="">全部</option>
							<option value="电动自行车">电动自行车</option>
							<option value="电动二轮车">电动二轮车</option>
							<option value="电动轮椅车">电动轮椅车</option>
							<option value="电动三轮车">电动三轮车</option>
							<option value="小型低速电动汽车">小型低速电动汽车</option>
							
						</select>
					</div>
					<div style="margin-bottom: 10px;float:left;margin-right: 10px;">
						<label class="label-top" style="width: 100%; display: block;">号牌号码</label>
						<input  id="hphm" name="_query.HPHM" class=" easyui-textbox theme-textbox-radius" style="width:212px;height:32px;text-align:center"/>
					</div>
					
					
					
					<!-- 
					
					
					<div style="margin-bottom: 10px;float:left;margin-right: 10px;height:30px;line-height:30px;">
						<label class="label-top" style="width: 40px; display: block;float:left;">车牌号</label>
						<input class="easyui-combobox"  style="width:110px;height:25px;"  id="HPHM" name="_query.HPHM"    
							data-options="
							url:'commonUtil/getVehicleInfo',
							method:'post',
							valueField:'hphm',
							textField:'hphm'
							">
					</div>
					<div style="margin-bottom: 10px;float:left;margin-right: 10px;height:30px;line-height:30px;">
						<label class="label-top" style="width: 40px; display: block;float:left;">档案号</label>
							<input class="easyui-combobox" style="width:170px;height:25px;"  id="LSH" name="_query.LSH" 
							data-options="
							url:'commonUtil/getVehicleInfo',
							method:'post',
							valueField:'lsh',
							textField:'lsh'
							">
					</div>
					<div style="margin-bottom: 10px;float:left;margin-right: 10px;height:30px;line-height:30px;">
						<label class="label-top" style="width: 50px; display: block;float:left;">身份证号</label>
						<input class="easyui-combobox" style="width:160px;height:25px;"  id="SFZMHM" name="_query.SFZMHM" 
							data-options="
							url:'commonUtil/getVehicleInfo',
							method:'post',
							valueField:'sfzmhm',
							textField:'sfzmhm'
							">
					</div> -->
					<div style="margin-bottom: 10px;float:left;margin-right: 10px;">
						<label class="label-top" style="width: 100%; display: block;">缴纳状态</label>
						<select name="_query.JNZT" class=" easyui-combobox theme-textbox-radius" id = "JNZT" style="width:212px;height:32px;text-align:center" data-options="editable: false">
							<option value="">全部</option>
							<option value="已缴纳">已缴纳</option>
							<option value="未缴纳">未缴纳</option>
							
						</select>
					</div>
					
					<div>
						<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'" style="width:212px;height:32px ;float:left;margin-top: 16px;margin-right: 10px; " onclick="searchFrom()">搜索</a>
						<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-clear'" style="width:212px;height:32px;float:left;margin-top: 16px;"   onclick="clearsj()">清除</a>
					</div>
					<input type="hidden" id="departmentids" value="${user.departmentids! }"></input>
					</form>
	   	 	</div>
	   	 	<div data-options="region:'center',border: false" style="overflow-x:hidden;"> 
				<table id="fineInfoTable" style="width:100%;height:100%;">
				</table>
	    	</div>
	    	
		<div id="menuContent" class="menuContent" style="display: none; position: absolute;z-index: 10;">
			<ul id="organSelectTree" class="ztree" style="margin-top:0;width: 200px;"></ul>
		</div>
	    	
<script type="text/javascript">

var levelnum = "${curOrgan.levelnum}";
var ids = "${curOrgan.ids}";
$(document).ready(function () {
	initFineInfoTable();

});

//清空搜索条件
function clearsj(){
	var initOrgan = $("#initOrgan").val();
	var initOrganName = $("#initOrganName").val();
	if(levelnum == "2"||levelnum == "1"||levelnum == "0"){
		$("#organIds").attr("value", "");
		$("#organ").attr("value", "");
	}else{
		$("#organIds").attr("value", initOrgan);
		$("#organ").attr("value", initOrganName);
	}
	
	$("#startTime").textbox("clear");
	$("#endTime").textbox("clear");
	$("#WFDM").textbox("clear");
	$("#CLLX").combobox("clear");
	$("#hphm").textbox("clear");
	$("#lsh").textbox("clear");
	$("#sfzmhm").textbox("clear");
	$("#JNZT").combobox("clear");
}


//格式化日期
$.fn.datetimebox.defaults.formatter = function(date){
    //显示格式: 2017-05-08 17(只显示年月日)
    var year = date.getFullYear();
    var month = date.getMonth() + 1;
    var day = date.getDate();
    month = month < 10 ? '0' + month : month;
    day = day < 10 ? '0' + day : day;
    return year + "-" + month + "-" + day;
}

function myformatter2(date){
    var y = date.getFullYear();
    var m = date.getMonth()+1;
    var d = date.getDate();
    return y+'-'+(m<10?('0'+m):m)+'-'+(d<10?('0'+d):d);
}
$(function () {
    var curr_time = new Date();
    $("#endTime").datebox("setValue",myformatter2(curr_time));
})

   	var $form = $('#fineInfoStatisticFrom');
	function searchFrom(){
		initFineInfoTable();
	}
	var columns = [[
			  		{field:'vid',title:'vid',width:130,align:'center',hidden:true},
			  		{field:'ids',title:'ids',width:100,align:'center',hidden:true},
			  		{field:'hphm',title:'号牌号码',width:80,align:'center'},
			  		{field:'cllx',title:'车辆类型',width:100,align:'center'},
			  		//{field:'lsh',title:'档案号',width:120,align:'center'},
			  		//{field:'sfzmhm',title:'身份证号',width:120,align:'center'},
			  		{field:'infractiondate',title:'违法时间',width:130,align:'center'},
			  		{field:'infractionplace',title:'违法地点',width:130,align:'center'},
			  		{field:'codecontent',title:'违法代码',width:200,align:'center'},
					{field:'punishment',title:'被处罚人',width:60,align:'center'},
					{field:'punishmentcontact',title:'联系方式',width:100,align:'center'},
					//{field:'pumoney',title:'罚款金额',width:50,align:'center'},
					//{field:'pumoneystatus',title:'缴纳状态',width:50,align:'center'},
					//{field:'qzcs',title:'行政强制措施',width:100,align:'center'},
					//{field:'sjwp',title:'收缴物品',width:100,align:'center'},
					//{field:'pudetails',title:'违法详情',width:150,align:'center'},
					//{field:'finepolice',title:'交通警察',width:60,align:'center'},
					//{field:'sdname',title:'部门',width:120,align:'center'},
					{field:'sdname',title:'机构',width:120,align:'center'},
					//{field:'creater',title:'创建人',width:50,align:'center'},
					//{field:'createdate',title:'创建时间',width:150,align:'center'},
					{field:'punote',title:'备注',width:200,align:'center'}
			      ]];
	function initFineInfoTable(){
		$('#fineInfoTable').datagrid({
			cls: "theme-datagrid",
			toolbar: '#tb',
			singleSelect: true,
			rownumbers: true, //显示序号
			pagination: true,
			pageSize: 10,
			url: "${cxt!}/fineQuery/querylist",
			queryParams: sy.serializeObject($form),
		    method: 'post',
			collapsible: true,
			remoteSort:false,
			multiSort:true,
			columns:columns,
			onLoadSuccess:function(){
				$('#fineInfoTable').datagrid("selectRow", 0);
				// 获取主表选中行
			},
			onClickRow:function(rowIndex,rowData){
			}
		});
	}
   </script>
	<script type="text/javascript">
			var setting = {
				async : {
					enable : true,
					url : '${cxt!}/common/getOrgenTree',
					autoParam : [ "id=ids" ],//, "name=n", "level=lv"
					type : "post"
				},
				view : {
					dblClickExpand : false
				},
				data : {
					simpleData : {
						enable : true
					}
				},
				callback : {
					onClick : onClick,
					onAsyncSuccess : organTreeOnAsyncSuccess
				}
			};
			var flag=0;//只初始化一次标识
			function organTreeOnAsyncSuccess(event, treeId, msg) {
				if(flag == 0){
					var organTree = $.fn.zTree.getZTreeObj("organSelectTree");
					var nodes = organTree.getNodes();
					flag = 1;
				}
			}
			function onClick(e, treeId, treeNode) {
				
				var zTree = $.fn.zTree.getZTreeObj("organSelectTree");
				var path = "";
				var sNodes = zTree.getSelectedNodes();
				if (sNodes.length > 0) {
					var node = sNodes[0].getPath();
					for(var i =0;i<node.length;i++){
						if(i == (node.length-1)){
							path += node[i].name;
						}else{
							path += node[i].name + "/";
						}
						
					}
				}
				var cityObj = $("#organ");
				cityObj.attr("value", path);
				$("#organIds").attr("value", treeNode.id);
				hideMenu();
			}
			function showMenu() {
				var cityObj = $("#organ");
				var cityOffset = $("#organ").offset();
				$("#menuContent").css({
					left : cityOffset.left + "px",
					top : cityOffset.top + cityObj.outerHeight() + "px"
				}).slideDown("fast");
		
				$("body").bind("mousedown", onBodyDown);
			}
			function hideMenu() {
				$("#menuContent").fadeOut("fast");
				$("body").unbind("mousedown", onBodyDown);
			}
			function onBodyDown(event) {
				if (!(event.target.id == "menuBtn"
						|| event.target.id == "menuContent" || $(event.target)
						.parents("#menuContent").length > 0)) {
					hideMenu();
				}
			}
			$.fn.zTree.init($("#organSelectTree"), setting);
		</script>
	</body>
</html>
